package com.learn.mapper;

import com.learn.pojo.AuthCode;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * @program: learn-parent
 * @description
 * @author: luffy
 * @create: 2020-09-16 10:14
 */
@Mapper
public interface AuthCodeMapper {
    /**
     * 通过邮箱查找验证码
     *
     * @param email
     * @return
     */
    @Select("select * from lagou_auth_code where email =#{email}")
    List<AuthCode> getAuthCodeByEmail(String email);

    /**
     * 创建验证码
     * @param email
     * @param code
     * @param createTime
     * @param expireTime
     */
    @Insert("insert into lagou_auth_code(email,code,createtime,expiretime) values(#{email},#{code},#{createTime},#{expireTime})")
    void createAuthCode(String email, String code, Date createTime, Date expireTime);
}
